package com.shrw.duke.serialport.utils;

/**
 * Created by rw-duke on 2018/1/16.
 */

public class ArrayUtils {

    public static int indexOf(Object[] res, Object target){
        int size = res.length;
        if (target == null) {
            for (int i = 0; i < size; i++)
                if (res[i]==null)
                    return i;
        } else {
            for (int i = 0; i < size; i++)
                if (target.equals(res[i]))
                    return i;
        }
        return 0;
    }
}
